/**
 * 
 */
package com.rpg.base.flyweight;


/**
 * @author Donald
 */
public abstract class IOItemData<T> {
	private String description;
	/**
	 * Gets the description 
	 * @return {@link String}
	 */
	public String getDescription() {
		return description;
	}
	/**
	 * Sets the description
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}
	/** flags for all class restrictions. */
	private long	classRestrictions;
	/** the current number in possession. */
	private short	count;				// current number
	/** modifier data for the item. */
	private T		equipitem;
	private char	food_value;
	/** the item's name. */
	private String	itemName;
	private short	LightValue;
	private short	maxcount;			// max number cumulable
	private short	playerstacksize;
	/** the item's price. */
	private int		price;
	/** flags for all race restrictions. */
	private long	raceRestrictions;
	private char	stealvalue;
	/**
	 * Adds a class restriction.
	 * @param flag the flag
	 */
	public final void addClassRestriction(final long flag) {
		classRestrictions |= flag;
	}
	/**
	 * Adds a race restriction.
	 * @param flag the flag
	 */
	public final void addRaceRestriction(final long flag) {
		raceRestrictions |= flag;
	}
	/** Clears all class restrictions that were set. */
	public final void clearClassRestrictions() {
		classRestrictions = 0;
	}
	/** Clears all race restrictions that were set. */
	public final void clearRaceRestrictions() {
		raceRestrictions = 0;
	}
	/**
	 * Gets the list of equipment item modifiers.
	 * @return {@link EquipmentItemModifier}[]
	 */
	public final T getEquipitem() {
		return equipitem;
	}
	/**
	 * Gets the item's name.
	 * @return {@link String}
	 */
	public final String getItemName() {
		return itemName;
	}
	/**
	 * Gets the item's price.
	 * @return {@link int}
	 */
	public final int getPrice() {
		return price;
	}
	/**
	 * Determines if the {@link IOItemData} has a specific class restriction.
	 * @param restriction the class restriction
	 * @return true if the {@link IOItemData} has the class restriction; false
	 *         otherwise
	 */
	public final boolean hasClassRestriction(final long restriction) {
		return (classRestrictions & restriction) == restriction;
	}
	/**
	 * Determines if the {@link IOItemData} has a specific race restriction.
	 * @param restriction the race restriction
	 * @return true if the {@link IOItemData} has the race restriction; false
	 *         otherwise
	 */
	public final boolean hasRaceRestriction(final long restriction) {
		return (raceRestrictions & restriction) == restriction;
	}
	/**
	 * Removes a class restriction.
	 * @param restriction the restriction
	 */
	public final void removeClassRestriction(final long restriction) {
		classRestrictions &= ~restriction;
	}
	/**
	 * Removes a race restriction.
	 * @param restriction the restriction
	 */
	public final void removeRaceRestriction(final long restriction) {
		raceRestrictions &= ~restriction;
	}
	/**
	 * Sets the equipitem
	 * @param val the equipitem to set
	 */
	public void setEquipitem(final T val) {
		this.equipitem = val;
	}
	/**
	 * Sets the item's name.
	 * @param val the name to set
	 */
	public final void setItemName(final String val) {
		this.itemName = val;
	}
	/**
	 * Sets the item's price.
	 * @param val the price to set
	 */
	public final void setPrice(final int val) {
		price = val;
	}
}
